import axios from './interceptor'

// 发布动态
function pushTalk(talk:string,type:string) {
  return axios.post('/talk',{
    talk,
    type,
    token:localStorage.getItem('token')
  })
}

// 查找动态列表
function getTalkData(page:string | number,type:string  =  '' ) {
  return axios.get(`/talk?page=${page}&limite=5&type=${type}`)
}

// 删除动态列表 
function removeTalk (id:string) {
  return axios.delete(`/talk/${id}`)
}
// 查找单个
function getTalkSingle(id:string) {
  return axios.get(`/talk/single?id=${id}`)
}
// 修改
function updateTalk(id:string,talk:string,type:string) {
  return axios.put('/talk',{
    id,talk,type, 
    token:localStorage.getItem('token')
  })
}
export {
  pushTalk,
  getTalkData,
  removeTalk,
  getTalkSingle,
  updateTalk
}
